using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using LTQT.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace LTQT.Pages
{
    public class ChooseModel : PageModel
    {
        private readonly LTQT.Data.LTQTContext _context;

        public ChooseModel(LTQT.Data.LTQTContext context)
        {
            _context = context;
        }

        [BindProperty]
        public List<Quiz> Quizs { get; set; }

        [BindProperty]
        public new User User { get; set; }

        public List<User> Users { get; set; }

        public void OnGet()
        {
            Quizs = _context.Quiz.ToList();
            Users = _context.User.ToList();
            User = Users.FirstOrDefault(m => m.Name == HttpContext.Session.GetString("USER_NAME"));
        }
    }
}
